<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <!-- 主表单区域 -->
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24" >
            <h2>项目信息</h2>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="客户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="customerName">
              <j-search-select-tag
                v-model="model.customerName"
                dict="EL_customerName"
                placeholder="请输入客户名称"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="客户编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="customerNumber">
              <j-search-select-tag
                v-model="model.customerNumber"
                dict="EL_customerNumber"
                placeholder="请输入客户编号"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="钳工担当" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fitterResponsibility">
              <j-search-select-tag
                v-model="model.fitterResponsibility"
                dict="EL_fitterResponsibility"
                placeholder="请输入钳工担当"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="项目担当" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="projectResponsibility">
              <j-search-select-tag
                v-model="model.projectResponsibility"
                dict="EL_projectResponsibility"
                placeholder="请输入项目担当"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="CHT模号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moduleNumber">
              <a-input v-model="model.moduleNumber" placeholder="请输入CHT模号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" >
            <h2>产品信息</h2>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productName">
              <a-input v-model="model.productName" placeholder="请输入产品名称" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productNumber">
              <a-input v-model="model.productNumber" placeholder="请输入产品编号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pic">
              <j-image-upload isMultiple  v-model="model.pic" ></j-image-upload>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" >
            <a-form-model-item label="产品材料/类型/编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialTypenum">
              <j-search-select-tag
                v-model="model.materialTypenum"
                dict="EL_materialTypenum"
                placeholder="请输入产品材料/类型/编号"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="收缩率" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shrinkage">
              <j-search-select-tag
                v-model="model.shrinkage"
                dict="EL_shrinkage"
                placeholder="请输入收缩率"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品尺寸" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productSize">
              <a-input v-model="model.productSize" placeholder="请输入产品尺寸" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品报价重量(G)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productQuoteWeight">
              <a-input v-model="model.productQuoteWeight" placeholder="请输入产品报价重量(G)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品实际重量(G)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productActualWeight">
              <a-input v-model="model.productActualWeight" placeholder="请输入产品实际重量(G)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="水口报价重量(G)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="waterOutletQuoteWeight">
              <a-input v-model="model.waterOutletQuoteWeight" placeholder="请输入水口报价重量(G)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="水口实际重量(G)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="waterOutletActualWeight">
              <a-input v-model="model.waterOutletActualWeight" placeholder="请输入水口实际重量(G)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" >
            <h2>模具信息</h2>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="进胶方案" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="glueFeedingScheme">
              <j-search-select-tag
                v-model="model.glueFeedingScheme"
                dict="EL_glueFeedingScheme"
                placeholder="请输入进胶方案"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="流道种类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="flowType">
              <j-search-select-tag
                v-model="model.flowType"
                dict="EL_flowType"
                placeholder="请输入流道种类"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具穴数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cavitiesNum">
              <j-search-select-tag
                v-model="model.cavitiesNum"
                dict="EL_cavitiesNum"
                placeholder="请输入模具穴数"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具难度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldDifficulty">
              <j-search-select-tag
                v-model="model.moldDifficulty"
                dict="EL_moldDifficulty"
                placeholder="请输入模具难度"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具寿命" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldLife">
              <a-input v-model="model.moldLife" placeholder="请输入模具寿命" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具尺寸" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldSize">
              <a-input v-model="model.moldSize" placeholder="请输入模具尺寸" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="顶出方案" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ejectorScheme">
              <a-input v-model="model.ejectorScheme" placeholder="请输入顶出方案" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="热流道品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hotRunnerBrand">
              <a-input v-model="model.hotRunnerBrand" placeholder="请输入热流道品牌" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="热咀数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hotSpoutsNum">
              <j-search-select-tag
                v-model="model.hotSpoutsNum"
                dict="EL_hotSpoutsNum"
                placeholder="请输入热咀数量"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模胚材质" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldMaterial">
              <j-search-select-tag
                v-model="model.moldMaterial"
                dict="EL_moldMaterial"
                placeholder="请输入模胚材质"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模芯材质" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="coreMaterial">
              <j-search-select-tag
                v-model="model.coreMaterial"
                dict="EL_coreMaterial"
                placeholder="请输入模芯材质"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具种类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldType">
              <j-search-select-tag
                v-model="model.moldType"
                dict="EL_moldType"
                placeholder="请输入模具种类"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24" >
            <h2>注塑成型信息</h2>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="试模机号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="trimmerNo">
              <j-search-select-tag
                v-model="model.trimmerNo"
                dict="EL_trimmerNo"
                placeholder="请输入试模机号"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="生产机号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productionNum">
              <j-search-select-tag
                v-model="model.productionNum"
                dict="EL_productionNum"
                placeholder="请输入生产机号"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="机台型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="machineModel">
              <j-search-select-tag
                v-model="model.machineModel"
                dict="EL_machineModel"
                placeholder="请输入机台型号"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="螺杆直径" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="screwDiameter">
              <j-search-select-tag
                v-model="model.screwDiameter"
                dict="EL_screwDiameter"
                placeholder="请输入螺杆直径"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="螺杆种类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="screwType">
              <j-search-select-tag
                v-model="model.screwType"
                dict="EL_screwType"
                placeholder="请输入螺杆种类"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="机台吨位报价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="machineTonnageQuotation">
              <j-search-select-tag
                v-model="model.machineTonnageQuotation"
                dict="EL_machineTonnage"
                placeholder="请输入机台吨位报价"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="机台吨位实际" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="machineTonnageActual">
              <j-search-select-tag
                v-model="model.machineTonnageActual"
                dict="EL_machineTonnage"
                placeholder="请输入机台吨位实际"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型周期报价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldingCycleQuotation">
              <a-input v-model="model.moldingCycleQuotation" placeholder="请输入成型周期报价" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型周期目标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldingCycleAim">
              <a-input v-model="model.moldingCycleAim" placeholder="请输入成型周期目标" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型周期实际" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldingCycleActual">
              <a-input v-model="model.moldingCycleActual" placeholder="请输入成型周期实际" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="炮筒最大射出量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maximumOutput">
              <a-input v-model="model.maximumOutput" placeholder="请输入炮筒最大射出量" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="射胶量百分比" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="injectionAmount">
              <a-input v-model="model.injectionAmount" placeholder="请输入射胶量百分比" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="料筒停留时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="residenceTime">
              <a-input v-model="model.residenceTime" placeholder="请输入料筒停留时间" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="熔胶温度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="meltTem">
              <a-input v-model="model.meltTem" placeholder="请输入熔胶温度" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="容模尺寸(长宽高)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="volumeSize">
              <j-search-select-tag
                v-model="model.volumeSize"
                dict="EL_volumeSize"
                placeholder="请输入容模尺寸(长宽高)"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="机械手种类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="manipulatorType">
              <j-search-select-tag
                v-model="model.manipulatorType"
                dict="EL_manipulatorType"
                placeholder="请输入机械手种类"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具温控箱" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tempControlBox">
              <j-search-select-tag
                v-model="model.tempControlBox"
                dict="EL_tempControlBox"
                placeholder="请输入模具温控箱"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模温机" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tempControlMachine">
              <j-search-select-tag
                v-model="model.tempControlMachine"
                dict="EL_tempControlMachine"
                placeholder="请输入模温机"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="手掌(EOAT)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eoat">
              <j-search-select-tag
                v-model="model.eoat"
                dict="EL_eoat"
                placeholder="请输入手掌(EOAT)"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24" >
            <h2>试模结束时间填写</h2>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="FAI要求时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fairequireTime">
              <j-date placeholder="请选择FAI要求时间"  v-model="model.fairequireTime" date-format="YYYY-MM-DD" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="FAI实际时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="faiactualTime">
              <j-date placeholder="请选择FAI实际时间"  v-model="model.faiactualTime" date-format="YYYY-MM-DD" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" >
            <a-form-model-item label="内部要求合格时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="insideRequireTime">
              <j-date placeholder="请选择内部要求合格时间"  v-model="model.insideRequireTime" date-format="YYYY-MM-DD" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" >
            <a-form-model-item label="内部实际合格时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="insideActualTime">
              <j-date placeholder="请选择内部实际合格时间"  v-model="model.insideActualTime" date-format="YYYY-MM-DD" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" >
            <a-form-model-item label="客户要求合格时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custRequireTime">
              <j-date placeholder="请选择客户要求合格时间"  v-model="model.custRequireTime" date-format="YYYY-MM-DD" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" >
            <a-form-model-item label="客户实际合格时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custActualTime">
              <j-date placeholder="请选择客户实际合格时间"  v-model="model.custActualTime" date-format="YYYY-MM-DD" style="width: 100%" />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
      <!-- 子表单区域 -->
    <a-tabs v-model="activeKey" @change="handleChangeTabs">
      <a-tab-pane tab="DFM完成时间" :key="refKeys[0]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[0]"
          :loading="dfmCompletionTimeTable.loading"
          :columns="dfmCompletionTimeTable.columns"
          :dataSource="dfmCompletionTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="模流完成时间" :key="refKeys[1]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[1]"
          :loading="moldflowCompletionTimeTable.loading"
          :columns="moldflowCompletionTimeTable.columns"
          :dataSource="moldflowCompletionTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="模具设计完成时间" :key="refKeys[2]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[2]"
          :loading="moldDesignCompletionTimeTable.loading"
          :columns="moldDesignCompletionTimeTable.columns"
          :dataSource="moldDesignCompletionTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true">
          <!-- <template v-slot:action="props">
            <a-select style="width: 300px" @change="handleCategoryChange">
              <a-select-option value="设计新模启动时间">设计新模启动时间</a-select-option>
              <a-select-option value="客户设变开始时间（改模）">客户设变开始时间（改模）</a-select-option>
              <a-select-option value="内部设变开始时间（修模）">内部设变开始时间（修模）</a-select-option>
            </a-select>
          </template> -->
        
        </j-editable-table>
      </a-tab-pane>
      <a-tab-pane tab="订购时间" :key="refKeys[3]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[3]"
          :loading="orderTimeTable.loading"
          :columns="orderTimeTable.columns"
          :dataSource="orderTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="模具加工完成时间" :key="refKeys[4]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[4]"
          :loading="moldProcessingCompletionTimeTable.loading"
          :columns="moldProcessingCompletionTimeTable.columns"
          :dataSource="moldProcessingCompletionTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="试模情况" :key="refKeys[5]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[5]"
          :loading="moldTestConditionTable.loading"
          :columns="moldTestConditionTable.columns"
          :dataSource="moldTestConditionTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
    </a-tabs>
  </a-spin>
</template>

<script>

  import { getAction } from '@/api/manage'
  import { FormTypes,getRefPromise,VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil'
  import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
  import { validateDuplicateValue } from '@/utils/util'

  export default {
    name: 'NewProjectProgressMainForm',
    mixins: [JEditableTableModelMixin],
    components: {
    },
    data() {
      return {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 10 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 13 },
        },
        model:{
        },
        // 新增时子表默认添加几行空数据
        addDefaultRowNum: 1,
        validatorRules: {
        },
        refKeys: ['moldTestCondition', 'moldDesignCompletionTime', 'moldProcessingCompletionTime', 'orderTime', 'moldflowCompletionTime', 'dfmCompletionTime', ],
        tableKeys:['moldTestCondition', 'moldDesignCompletionTime', 'moldProcessingCompletionTime', 'orderTime', 'moldflowCompletionTime', 'dfmCompletionTime', ],
        activeKey: 'moldTestCondition',
        // 试模情况
        moldTestConditionTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '试模要求时间',
              key: 'requiredTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '试模实际时间',
              key: 'testActualTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '问题点',
              key: 'questionPoint',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '对策',
              key: 'countermeasures',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '质量目标',
              key: 'qualityObjectives',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '实际质量',
              key: 'actualObjectives',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // 模具设计完成时间
        moldDesignCompletionTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型',
              key: 'timeType',
              type: FormTypes.select,
              // slotName: 'action',
              options:[{'title':'设计新模启动时间','value':'设计新模启动时间'},
                       {'title':'客户设变开始时间（改模）','value':'客户设变开始时间（改模）'},
                       {'title':'内部设变开始时间（修模）','value':'内部设变开始时间（修模）'},
                      ],
              width:"300px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '设计检讨时间',
              key: 'designReviewTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '计划完成时间',
              key: 'plannedCompletionTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '实际完成时间',
              key: 'actualCompletionTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '项目发出时间',
              key: 'projectIssueTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户回复时间',
              key: 'customerResponseTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // 模具加工完成时间
        moldProcessingCompletionTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间选项',
              key: 'timeType',
              type: FormTypes.select,
              options:[{'title':'新模加工计划','value':'新模加工计划'},
                       {'title':'客户设变加工计划（改模）','value':'客户设变加工计划（改模）'},
                       {'title':'内部设变加工计划（修模）','value':'内部设变加工计划（修模）'},
                      ],
              width:"300px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '计划完成时间',
              key: 'plannedTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '实际完成时间',
              key: 'actualTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // 订购时间
        orderTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型',
              key: 'timeType',
              type: FormTypes.select,
              options:[{'title':'模胚订购到厂时间','value':'模胚订购到厂时间'},
                       {'title':'热流道订购到厂时间','value':'热流道订购到厂时间'},
                       {'title':'钢料订购到厂时间','value':'钢料订购到厂时间'},
                      ],
              width:"300px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '计划时间',
              key: 'scheduleTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '实际时间',
              key: 'actualTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // 模流完成时间
        moldflowCompletionTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型',
              key: 'timeType',
              type: FormTypes.select,
              options:[{'title':'新模启动时间','value':'新模启动时间'},
                       {'title':'客户设变开始时间（改模）','value':'客户设变开始时间（改模）'},
                       {'title':'内部设变开始时间（修模）','value':'内部设变开始时间（修模）'},
                      ],
              width:"300px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '项目发出时间',
              key: 'proStartTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户回复时间',
              key: 'custReplyTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // DFM完成时间
        dfmCompletionTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型选项',
              key: 'timeType',
              type: FormTypes.select,
              options:[{'title':'新模启动时间','value':'新模启动时间'},
                       {'title':'客户设变开始时间（改模）','value':'客户设变开始时间（改模）'},
                       {'title':'内部设变开始时间（修模）','value':'内部设变开始时间（修模）'},
                      ],
              width:"300px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '项目发出时间',
              key: 'startTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户回复时间',
              key: 'replyTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        url: {
          add: "/ch/newProjectProgressMain/add",
          edit: "/ch/newProjectProgressMain/edit",
          queryById: "/ch/newProjectProgressMain/queryById",
          moldTestCondition: {
            list: '/ch/newProjectProgressMain/queryMoldTestConditionByMainId'
          },
          moldDesignCompletionTime: {
            list: '/ch/newProjectProgressMain/queryMoldDesignCompletionTimeByMainId'
          },
          moldProcessingCompletionTime: {
            list: '/ch/newProjectProgressMain/queryMoldProcessingCompletionTimeByMainId'
          },
          orderTime: {
            list: '/ch/newProjectProgressMain/queryOrderTimeByMainId'
          },
          moldflowCompletionTime: {
            list: '/ch/newProjectProgressMain/queryMoldflowCompletionTimeByMainId'
          },
          dfmCompletionTime: {
            list: '/ch/newProjectProgressMain/queryDfmCompletionTimeByMainId'
          },
        }
      }
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
    },
    methods: {
      // handleCategoryChange(prop){
      //   console.log(prop)
      //   if(prop == '设计新模启动时间'){
      //     console.log('123333321321321312321312312332131')
      //     this.moldDesignCompletionTimeTable.columns[4].type = FormTypes.hidden
      //     this.moldDesignCompletionTimeTable.columns[5].type = FormTypes.hidden
      //   }if(prop == '客户设变开始时间（改模）'|| prop == '内部设变开始时间（修模）'){
      //     this.moldDesignCompletionTimeTable.columns[1].type = FormTypes.hidden
      //     this.moldDesignCompletionTimeTable.columns[2].type = FormTypes.hidden
      //     this.moldDesignCompletionTimeTable.columns[3].type = FormTypes.hidden
      //   }
      // },
      addBefore(){
        this.moldTestConditionTable.dataSource=[]
        this.moldDesignCompletionTimeTable.dataSource=[]
        this.moldProcessingCompletionTimeTable.dataSource=[]
        this.orderTimeTable.dataSource=[]
        this.moldflowCompletionTimeTable.dataSource=[]
        this.dfmCompletionTimeTable.dataSource=[]
      },
      getAllTable() {
        let values = this.tableKeys.map(key => getRefPromise(this, key))
        return Promise.all(values)
      },
      /** 调用完edit()方法之后会自动调用此方法 */
      editAfter() {
        this.$nextTick(() => {
        })
        // 加载子表数据
        if (this.model.id) {
          let params = { id: this.model.id }
          this.requestSubTableData(this.url.moldTestCondition.list, params, this.moldTestConditionTable)
          this.requestSubTableData(this.url.moldDesignCompletionTime.list, params, this.moldDesignCompletionTimeTable)
          this.requestSubTableData(this.url.moldProcessingCompletionTime.list, params, this.moldProcessingCompletionTimeTable)
          this.requestSubTableData(this.url.orderTime.list, params, this.orderTimeTable)
          this.requestSubTableData(this.url.moldflowCompletionTime.list, params, this.moldflowCompletionTimeTable)
          this.requestSubTableData(this.url.dfmCompletionTime.list, params, this.dfmCompletionTimeTable)
        }
      },
      //校验所有一对一子表表单
      validateSubForm(allValues){
          return new Promise((resolve,reject)=>{
            Promise.all([
            ]).then(() => {
              resolve(allValues)
            }).catch(e => {
              if (e.error === VALIDATE_NO_PASSED) {
                // 如果有未通过表单验证的子表，就自动跳转到它所在的tab
                this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
              } else {
                console.error(e)
              }
            })
          })
      },
      /** 整理成formData */
      classifyIntoFormData(allValues) {
        let main = Object.assign(this.model, allValues.formValue)
        return {
          ...main, // 展开
          moldTestConditionList: allValues.tablesValue[0].values,
          moldDesignCompletionTimeList: allValues.tablesValue[1].values,
          moldProcessingCompletionTimeList: allValues.tablesValue[2].values,
          orderTimeList: allValues.tablesValue[3].values,
          moldflowCompletionTimeList: allValues.tablesValue[4].values,
          dfmCompletionTimeList: allValues.tablesValue[5].values,
        }
      },
      validateError(msg){
        this.$message.error(msg)
      },

    }
  }
</script>

<style scoped>
</style>